package com.pd.backend.map;

import com.pd.backend.entity.PdAuthUser;
import com.pd.backend.map.mapentity.PdAuthUserMapEntity;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.Date;

/**
 * @ClassName PdAuthUserMap
 * @Description TODO
 * @date 2023/2/27 21:50
 * @Version 1.0
 */
@Mapper
public abstract class PdAuthUserMap {
    public static PdAuthUserMap INSTANCT = Mappers.getMapper(PdAuthUserMap.class);
    //source为原有的字段表示
    //target为目标Dto的字段表示
    @Mapping(source = "id", target = "id")
    @Mapping(source = "account", target = "account")
    @Mapping(source = "name", target = "name")
    @Mapping(source = "orgId", target = "orgId")
    @Mapping(source = "stationId", target = "stationId")
    @Mapping(source = "email", target = "email")
    @Mapping(source = "mobile", target = "mobile")

    @Mapping(source = "avatar", target = "avatar")
    @Mapping(source = "workDescribe", target = "workDescribe")
    //判断数字转换为boolean
    //@Mapping(source = "status", target = "status")
    //@Mapping(source = "lastLoginTime", target = "lastLoginTime")
    //特殊处理
    @Mapping(target = "status", ignore = true)//或略不进行映射
    @Mapping(target = "lastLoginTime", ignore = true)//或略不进行映射
    @Mapping(target = "sex", ignore = true)//或略不进行映射

//    @Mapping(target = "passwordErrorLastTime", ignore = true)//或略不进行映射
//    @Mapping(target = "passwordErrorNum", ignore = true)//或略不进行映射
//    @Mapping(target = "passwordExpireTime", ignore = true)//或略不进行映射
//    @Mapping(target = "password", ignore = true)//或略不进行映射
//    @Mapping(target = "createUser", ignore = true)//或略不进行映射
//    @Mapping(target = "createTime", ignore = true)//或略不进行映射
//    @Mapping(target = "updateUser", ignore = true)//或略不进行映射
//    @Mapping(target = "updateTime", ignore = true)//或略不进行映射
    public abstract PdAuthUserMapEntity conver(PdAuthUser user);
}
